
var touristSpots = [{
    name: '小凉',
    position: [108.571139594185, 31.029690212674],
    smallIcon: './images/树.png',
}, {
    name: '竹林',
    position: [108.570999348959, 31.028928765191],
    smallIcon: './images/竹.png',
}, {
    name: '刺柏树',
    position: [108.571448567709, 31.029813639323],
    smallIcon: './images/刺柏树.png',
}, {
    name: '铁塔',
    position: [108.573394, 31.033488],
    smallIcon: './images/铁塔.png',
},
{
    name: '屋迹',
    position: [108.5729905327697, 31.029928466797493],
    smallIcon: './images/屋迹.png',
},
{
    name: '屋迹2',
    position: [108.57324240451439, 31.030878092448297],
    smallIcon: './images/屋迹.png',
},
{
    name: '竹林',
    position: [108.571766, 31.029446],
    smallIcon: './images/竹.png',
}, {
    name: '这是家',
    position: [108.571049, 31.028362],
    smallIcon: './images/png.png',
}];


for (var i = 0; i < touristSpots.length; i += 1) {
    // 创建一个 Icon
    var startIcon = new AMap.Icon({
        // 图标尺寸
        size: new AMap.Size(40, 30),
        // 图标的取图地址
        image: touristSpots[i].smallIcon,
        // 图标所用图片大小
        imageSize: new AMap.Size(40, 30)
    });

    // 将 icon 传入 marker
    var startMarker = new AMap.Marker({
        position: touristSpots[i].position,
        icon: startIcon,
        offset: new AMap.Pixel(-20, -30)
    });

    startMarker.setLabel({
        content: "<div class='info'>"+touristSpots[i].name+"</div>", //设置文本标注内容
        offset: new AMap.Pixel(0, 0),
        direction: 'bottom' //设置文本标注方位
    });

    map.add(startMarker);
}

